package sketch.experiment.complexdatastructure;

import bintree.BinTree;
import sketch.ounit.Observer;
import sketch.ounit.Values;
import sketch.specs.annotation.TestSketch;
import junit.framework.TestCase;

/**
 * The sketch for binary tree
 * */
public class Z_Sketch_BinTree extends TestCase {

	@TestSketch //16 lines in total
	public void testBinTree() {
		BinTree tree = new BinTree();
		Integer[] ints = Values.exhaust(1, 2, 3, 4);
		for(int i : ints) {
			tree.add(i);
			assertTrue(tree.find(i));
		}
		Observer.observeExpr(tree.remove(1));
		Observer.observeExpr(tree.find(1));
		Observer.observeExpr(tree.remove(2));
		Observer.observeExpr(tree.find(2));
		Observer.observeExpr(tree.remove(3));
		Observer.observeExpr(tree.find(3));
		Observer.observeExpr(tree.remove(4));
		Observer.observeExpr(tree.find(4));
//		int rf = Values.choose(1, 2, 3, 4);
//		{/**@Repeat*/
//			tree.remove(rf);
//			assertTrue(tree.find(rf) == false);
//		}
		
//		int[] rf = new int[]{1, 2, 3, 4};
//		for(int r : rf) {
//			tree.remove(r);
//			assertTrue(tree.find(r) == false);
//		}
	}
	
}